#include"TrPrDefault.h" 

#include"Song.h"

TrPrDefault::TrPrDefault(QList< QPointer<Song> > *songs, RepeatType repeat) : TrackProgression(songs), m_repeatType(repeat){
	m_index = -1;
}

TrPrDefault::~TrPrDefault(){
	
}

bool TrPrDefault::next(){
	if(m_repeatType == RepeatOne && m_index > -1 && m_index < m_songs->size())
		return true;
	
	if(m_index + 1 < m_songs->size())
		m_index++;
	else{
		if(m_repeatType == NoRepeat)
			m_index = -1;
		else
			m_index = 0;
	}
	
	return m_index > -1;
}

void TrPrDefault::previous(){
	if(m_index > 0)
		m_index--;
}

int TrPrDefault::current(){
	return m_index;
}

void TrPrDefault::setIndex(short int index){
	m_index = index;
}

